package com.driving.single.frontend.portal.controller;

import com.driving.single.common.entity.DrivingResult;
import com.driving.single.frontend.portal.service.PortalContentService;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping(value = "/frontend/portal", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public class PortalContentController {
    @Resource
    private PortalContentService portalContentService;

    /**
     * 首页大广告位接口
     */
    @GetMapping("/selectPortalBAD")
    public DrivingResult selectFrontendContentBad() {
        try {
            return this.portalContentService.selectFrontendContentBad();
        } catch (Exception e) {
            e.printStackTrace();
        }
        return DrivingResult.error("error");
    }

    /**
     * 首页小广告位接口
     */
    @GetMapping("/selectPortalSmallAD")
    public DrivingResult selectFrontendContentSmallAd() {
        try {
            return this.portalContentService.selectFrontendContentSmallAd();
        } catch (Exception e) {
            e.printStackTrace();
        }
        return DrivingResult.error("error");
    }

    /**
     * 首页中部广告位接口
     */
    @GetMapping("/selectPortalMiddleAD")
    public DrivingResult selectFrontendContentMiddleAd() {
        try {
            return this.portalContentService.selectFrontendContentMiddleAd();
        } catch (Exception e) {
            e.printStackTrace();
        }
        return DrivingResult.error("error");
    }

    /**
     * 首页驾校边栏广告位接口
     */
    @GetMapping("/selectPortalSchSideAD")
    public DrivingResult selectPortalSchSideAd() {
        try {
            return this.portalContentService.selectPortalSchSideAd();
        } catch (Exception e) {
            e.printStackTrace();
        }
        return DrivingResult.error("error");
    }

    /**
     * 首页驾校推荐广告位接口
     */
    @GetMapping("/selectPortalSchRecommAD")
    public DrivingResult selectPortalSchRecommAd() {
        try {
            return this.portalContentService.selectPortalSchRecommAd();
        } catch (Exception e) {
            e.printStackTrace();
        }
        return DrivingResult.error("error");
    }

    /**
     * 首页教练推荐广告位接口
     */
    @GetMapping("/selectPortalCoachRecommAD")
    public DrivingResult selectPortalCoachRecommAd() {
        try {
            return this.portalContentService.selectPortalCoachRecommAd();
        } catch (Exception e) {
            e.printStackTrace();
        }
        return DrivingResult.error("error");
    }

    /**
     * 首页陪练推荐广告位接口
     */
    @GetMapping("/selectPortalPartnerRecommAD")
    public DrivingResult selectPortalSparRecommAd() {
        try {
            return this.portalContentService.selectPortalSparRecommAd();
        } catch (Exception e) {
            e.printStackTrace();
        }
        return DrivingResult.error("error");
    }

    /**
     * 首页尾部广告位接口
     */
    @GetMapping("/selectPortalFootAD")
    public DrivingResult selectPortalFootAd() {
        try {
            return this.portalContentService.selectPortalFootAd();
        } catch (Exception e) {
            e.printStackTrace();
        }
        return DrivingResult.error("error");
    }
}
